package com.bighero.mq_to_mail.pAndC.utils;

import com.bighero.mq_to_mail.pAndC.bean.CityInfoBean;
import com.bighero.mq_to_mail.pAndC.bean.DataBean;
import com.bighero.mq_to_mail.pAndC.bean.ForecastBean;
import com.bighero.mq_to_mail.pAndC.bean.WeatherBean;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class AssembleTianQi {

    public String zuZhuangTiqnQi(WeatherBean weatherBean){
        //解析
        CityInfoBean cityInfo = weatherBean.cityInfo;
        StringBuilder sb = new StringBuilder();
        sb.append("<p> 今日："+ cityInfo.getCity() +"天气情况如下：</p>");
        DataBean data = weatherBean.getData();

        List<ForecastBean> forecast = data.getForecast();
        ForecastBean forecastBean = forecast.get(0);
        sb.append("<p>     最高温度："+ forecastBean.getHigh() +"</p>");
        sb.append("<p>     最低温度："+ forecastBean.getLow() +"</p>");
        sb.append("<p>     风向："+ forecastBean.getFx() +"</p>");
        sb.append("<p>     风力："+ forecastBean.getFl() +"</p>");
        sb.append("<p>     天气："+ forecastBean.getType() +"</p>");
        sb.append("<p>     湿度："+ data.getShidu() +"</p>");
        sb.append("<p>     pm2.5："+ data.getPm25() +"</p>");
        sb.append("<p>     pm10："+ data.getPm10() +"</p>");
        sb.append("<p>     空气质量："+ data.getQuality() +"</p>");
        sb.append("<p>     飞哥小贴士："+ forecastBean.getNotice() +"</p>");
        return sb.toString();

    }

}
